package name.hankc.spring.bean.awared;

import java.util.stream.Stream;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class AwaredTestBean implements ApplicationContextAware {

  private ApplicationContext ctx;

  public void printBeanNames() {
    Stream.of(ctx.getBeanDefinitionNames()).forEach(System.out::println);
  }

  @Override
  public void setApplicationContext(ApplicationContext ctx) throws BeansException {
    this.ctx = ctx;
  }
}